package com.stenio.fancat.annotation;

import com.stenio.fancat.validator.TokenValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Constraint(validatedBy = TokenValidator.class)
@Target(ElementType.METHOD)  //这个注解是应用在方法上
@Retention(RetentionPolicy.RUNTIME)  //注解会在class中存在，运行时可通过反射获取
@Documented
public @interface AuthToken {

    boolean required() default true;

    String message() default "Token不合法";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
